package com.winter.config;

import com.winter.service.BaffleAnService;
import org.apache.ibatis.javassist.*;
import org.apache.ibatis.javassist.bytecode.CodeAttribute;
import org.apache.ibatis.javassist.bytecode.LocalVariableAttribute;
import org.apache.ibatis.javassist.bytecode.MethodInfo;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;


/**
 * 挡板切面类
 */
@EnableAspectJAutoProxy
@Component
@Aspect
public class BaffleAnAspect {

    @Pointcut("@annotation(com.winter.annotation.BaffleAn)")
    public void point() {}
    
    @Around("point()")
    public Object around(ProceedingJoinPoint point) throws Throwable {
        return BaffleAnService.handler(point);
    }
    
    public static Map<String,Object> getFieldsNameValueMap(JoinPoint joinPoint) throws Exception {
        MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
        String[] parameterNames = methodSignature.getParameterNames();
        return null;
    }    
}